package com.satan.elasticsearch.manager.mq;

import com.satan.elasticsearch.constant.HotelMqConsts;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author: Demon
 * @Date: 2024/2/19 00:07
 * @Description:
 **/
@Component
@RequiredArgsConstructor
public class HotelMqMsgManager {
    // 定义一个AmqpTemplate实例，用于发送和接收AMQP消息
    private final AmqpTemplate amqpTemplate;
    public void sendHotelInsertMsg(Long id) {
            amqpTemplate.convertAndSend(HotelMqConsts.HOTEL_EXCHANGE, HotelMqConsts.HOTEL_INSERT_KEY, id);
    }
    public void sendHotelDeleteMsg(Long id) {
        amqpTemplate.convertAndSend(HotelMqConsts.HOTEL_EXCHANGE, HotelMqConsts.HOTEL_DELETE_KEY, id);
    }
}
